home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14398 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Check if a file exists?
  5. Date: Sun, 14 Apr 96 11:29:38 GMT
  6. Organization: none
  7. Message-ID: <829481378snz@genesis.demon.co.uk>
  8. References: <4kp7pg$upe@news-s01.ny.us.ibm.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4kp7pg$upe@news-s01.ny.us.ibm.net>
  15.            bfilone@ibm.net "bfilone@ibm.net " writes:
  16.  
  17. >Is it possible in C to check if a file exists other than checking for a
  18. > succesful fopen?
  19.  
  20. There is no other way in standard C. The only standard C library functions
  21. that actually take a filename are fopen, freopen, rename and remove.
  22.  
  23. >ON a unix machine, I just want to know if a file is there or not, do not
  24. >to read or write anything to it. similar to the -f test in unix?
  25.  
  26. That would be implemented in Unix using stat(), however that isn't a standard
  27. C library function. For further information on Unix specific calls see
  28. comp.unix.programmer.
  29.  
  30. -- 
  31. -----------------------------------------
  32. Lawrence Kirby | fred@genesis.demon.co.uk
  33. Wilts, England | 70734.126@compuserve.com
  34. -----------------------------------------
  35.